#ifndef _SDRAM_DDR_DEFINE_H
#define _SDRAM_DDR_DEFINE_H

#include "SDRAM_define.h"

struct SDRAM_DDR_data_t
{
	unsigned	upper_bytes;
	unsigned	lower_bytes;

	SDRAM_DDR_data_t()
		: upper_bytes	(0)
		, lower_bytes	(0)
	{}

	SDRAM_DDR_data_t(unsigned upper_bytes_,
					 unsigned lower_bytes_)
		: upper_bytes	(upper_bytes_)
		, lower_bytes	(lower_bytes_)
	{}
};

struct SDRAM_DDR_mode_register_t
{
	bool		active_power_down_slow_exit;
	unsigned	write_recovery;
	bool		DLL_reset;
	bool		test_mode;
	unsigned	CAS_latency;
	bool		burst_type;
	unsigned	burst_length;

	bool		output_buffer_enable;
	bool		RDQS_enable;
	bool		DQS_bar_enable;
	unsigned	OCD_calibration_program;
	unsigned	additive_latency;
	unsigned	ODT_resistance;
	bool		output_driver_impedance_control;
	bool		DLL_enable;

	bool		high_temperature_self_refresh_rate_enable;
	unsigned	partial_array_self_refresh;
};

struct SDRAM_DDR_bank_state_t
	: SDRAM_bank_state_t 
{
	unsigned		write_recovery_count;
};

struct SDRAM_DDR_bank_control_info_t
	: SDRAM_bank_control_info_t
{
	unsigned		tDQSS_cnt;
	unsigned		tWR_cnt;
};

const SDRAM_bitwidth_t	DDR_EXT_BITWIDTH_MODULE		= 64;
const SDRAM_bitwidth_t	DDR_EXT_BITWIDTH_COMPONENT	= 8;

const SDRAM_num_t		DDR_DEFAULT_RANK_NUM		= 2;
const SDRAM_num_t		DDR_DEFAULT_BANK_NUM		= 4;
//const SDRAM_num_t		DDR_DEFAULT_ROW_NUM			= 8192;
const SDRAM_num_t		DDR_DEFAULT_ROW_NUM			= 2048;
const SDRAM_num_t		DDR_DEFAULT_COL_NUM			= 1024;

const unsigned			DDR_DEFAULT_CL				= 6;
const unsigned			DDR_DEFAULT_tRCD			= 6;
const unsigned			DDR_DEFAULT_tRP				= 6;
const unsigned			DDR_DEFAULT_tRFC			= 51;
const unsigned			DDR_DEFAULT_tRFCI			= 3120;
const unsigned			DDR_DEFAULT_tWR				= 6;
const unsigned			DDR_DEFAULT_tDQSS			= 1;

const unsigned			DDR_DEFAULT_BURST_LENGTH	= 4;
const unsigned			DDR_MAX_BURST_LENGTH		= 8;

const unsigned			DDR_DEFAULT_OCD_PROGRAM		= 0;
const unsigned			DDR_DEFAULT_AL				= 0;
const unsigned			DDR_DEFAULT_ODT_RESISTANCE	= 0;

const unsigned			DDR_DEFAULT_PASR			= 0;

#endif
